.class public Lcom/waiqin365/h5/io/WqUploadFile;
.super Lorg/apache/cordova/CordovaPlugin;


# instance fields
.field a:Ljava/lang/String;

.field b:Ljava/util/Map;

.field private c:Lorg/apache/cordova/CallbackContext;

.field private d:Lorg/apache/cordova/WqCordovaActivity;


# direct methods
.method public constructor <init>()V
    .locals 1

    invoke-direct {p0}, Lorg/apache/cordova/CordovaPlugin;-><init>()V

    const-string/jumbo v0, ""

    iput-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->a:Ljava/lang/String;

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->b:Ljava/util/Map;

    return-void
.end method

.method static synthetic a(Lcom/waiqin365/h5/io/WqUploadFile;)Lorg/apache/cordova/WqCordovaActivity;
    .locals 1

    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    return-object v0
.end method


# virtual methods
.method public execute(Ljava/lang/String;Lorg/apache/cordova/CordovaArgs;Lorg/apache/cordova/CallbackContext;)Z
    .locals 9

    const/4 v1, 0x0

    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->cordova:Lorg/apache/cordova/CordovaInterface;

    invoke-interface {v0}, Lorg/apache/cordova/CordovaInterface;->getActivity()Landroid/app/Activity;

    move-result-object v0

    check-cast v0, Lorg/apache/cordova/WqCordovaActivity;

    iput-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    iput-object p3, p0, Lcom/waiqin365/h5/io/WqUploadFile;->c:Lorg/apache/cordova/CallbackContext;

    const/4 v0, 0x0

    :try_start_0
    invoke-virtual {p2, v0}, Lorg/apache/cordova/CordovaArgs;->getString(I)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->a:Ljava/lang/String;

    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    const-string/jumbo v0, ""

    new-instance v5, Lorg/json/JSONObject;

    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->a:Ljava/lang/String;

    invoke-direct {v5, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string/jumbo v0, "filePathList"

    invoke-virtual {v5, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_4

    const-string/jumbo v0, "filePathList"

    invoke-virtual {v5, v0}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v6

    move v2, v1

    :goto_0
    invoke-virtual {v6}, Lorg/json/JSONArray;->length()I

    move-result v0

    if-ge v2, v0, :cond_2

    invoke-virtual {v6, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v0

    const-string/jumbo v7, "fileAlias"

    invoke-virtual {v0, v7}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-virtual {v6, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v0

    const-string/jumbo v7, "fileAlias"

    invoke-virtual {v0, v7}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :goto_1
    invoke-interface {v4, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    new-instance v0, Ljava/io/File;

    invoke-virtual {v6, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v7

    const-string/jumbo v8, "path"

    invoke-virtual {v7, v8}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v7

    invoke-direct {v0, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v7

    if-eqz v7, :cond_0

    invoke-interface {v3, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_0
    add-int/lit8 v0, v2, 0x1

    move v2, v0

    goto :goto_0

    :cond_1
    const-string/jumbo v0, ""

    goto :goto_1

    :cond_2
    if-eqz v3, :cond_3

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v0

    if-gtz v0, :cond_5

    :cond_3
    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    const v2, 0x7f08080e

    invoke-virtual {v0, v2}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Lorg/apache/cordova/CallbackContext;->error(Ljava/lang/String;)V

    move v0, v1

    :goto_2
    return v0

    :cond_4
    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    const v2, 0x7f080615

    invoke-virtual {v0, v2}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Lorg/apache/cordova/CallbackContext;->error(Ljava/lang/String;)V

    move v0, v1

    goto :goto_2

    :cond_5
    const-string/jumbo v0, "url"

    invoke-virtual {v5, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_6

    const-string/jumbo v0, "url"

    invoke-virtual {v5, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    invoke-static {v1, v3, v4, v0}, Lcom/fiberhome/upload/c/b;->a(Landroid/content/Context;Ljava/util/List;Ljava/util/List;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_3
    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    invoke-virtual {v0}, Lorg/apache/cordova/WqCordovaActivity;->getThreadPool()Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    new-instance v1, Lcom/waiqin365/h5/io/d;

    invoke-direct {v1, p0}, Lcom/waiqin365/h5/io/d;-><init>(Lcom/waiqin365/h5/io/WqUploadFile;)V

    invoke-interface {v0, v1}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V

    const/4 v0, 0x1

    goto :goto_2

    :cond_6
    :try_start_1
    iget-object v0, p0, Lcom/waiqin365/h5/io/WqUploadFile;->d:Lorg/apache/cordova/WqCordovaActivity;

    const v2, 0x7f08080e

    invoke-virtual {v0, v2}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Lorg/apache/cordova/CallbackContext;->error(Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move v0, v1

    goto :goto_2

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_3
.end method
